package cn.muqingfeng.api.to;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;

public class BaseArticle1DataTO implements Parcelable {

	@SerializedName("threads")
	private List<Article1TO> list;

	public BaseArticle1DataTO() {
	}

	public BaseArticle1DataTO(Parcel source) {
		list = new ArrayList<Article1TO>();
		source.readTypedList(list, Article1TO.CREATOR);
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeTypedList(list);
	}

	public static final Creator<BaseArticle1DataTO> CREATOR = new Creator<BaseArticle1DataTO>() {

		@Override
		public BaseArticle1DataTO[] newArray(int size) {
			return new BaseArticle1DataTO[size];
		}

		@Override
		public BaseArticle1DataTO createFromParcel(Parcel source) {
			return new BaseArticle1DataTO(source);
		}
	};

	public List<Article1TO> getList() {
		return list == null ? new ArrayList<Article1TO>() : list;
	}

	public void setList(List<Article1TO> list) {
		this.list = list;
	}

	public String toGsonString() {
		Gson gson = new Gson();
		return gson.toJson(this);
	}

}
